package com.ls.markt.controller.superLeague;

import com.ls.markt.enums.EventsEnum;
import com.ls.markt.service.admin.ClubService;
import com.ls.markt.service.admin.EventsService;
import com.ls.markt.service.admin.PlayerService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;

/**
 * @descrption 中超页面 控制器类
 */
@Controller
@RequestMapping("/superLeague")
public class SuperLeagueController {

    @Resource
    private ClubService clubService;

    @Resource
    private PlayerService playerService;

    @Resource
    EventsService eventsService;

    @GetMapping("/index")
    public ModelAndView index(Model model){
        Long eventsId  = eventsService.getIdByName(EventsEnum.SUPER.getCode());
        int teams = clubService.getClubNumberByLevel(eventsId);//球队数量
        model.addAttribute("teams",teams);

        int players = playerService.getPlayerNumberByLevel(eventsId);//球员人数
        model.addAttribute("players",players);
        return new ModelAndView("superLeague/index","superModel",model) ;
    }

//    @GetMapping("/overview")
//    public String overview(){
//        return "superLeague/overview";
//    }

    //Information & facts ===============================begin
    /**
     * 跳转到所有冠军页面
     * @return
     */
    @GetMapping("/allChampions")
    public String allChampions(){
        return "superLeague/allChampions";
    }
    //Information & facts ===============================end


    //History ===============================begin
    /**
     * 跳转到最大的胜利页面
     * @return
     */
    @GetMapping("/biggestVictory")
    public String biggestVictory(){
        return "superLeague/biggestVictory";
    }
    //History ===============================end

}
